www.gusucode.com > VC++ 新手写的简单客房管理系统源码程序 > VC++ 新手写的简单客房管理系统源码程序/code/tot/totView.cpp
//Download by http://www.NewXing.com // totView.cpp : implementation of the CTotView class // #include "stdafx.h" #include "tot.h" #include "totDoc.h" #include "totView.h" #include "LogDialog.h" #include "AskstateDialog.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CTotView IMPLEMENT_DYNCREATE(CTotView, CView) BEGIN_MESSAGE_MAP(CTotView, CView) //{{AFX_MSG_MAP(CTotView) ON_COMMAND(ID_MENU1_DATA, OnMenu1Data) ON_COMMAND(ID_MENU2_DATA, OnMenu2Data) ON_UPDATE_COMMAND_UI(ID_MENU2_DATA, OnUpdateMenu2Data) ON_WM_SIZE() //}}AFX_MSG_MAP // Standard printing commands ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint) ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CTotView construction/destruction CTotView::CTotView() { // TODO: add construction code here jBitmap.LoadBitmap(IDB_BITMAP1); jBitmap.GetBitmap (&BMPstruct); k=1; m_Login=FALSE; } CTotView::~CTotView() {jBitmap.DeleteObject(); } BOOL CTotView::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs return CView::PreCreateWindow(cs); } ///////////////////////////////////////////////////////////////////////////// // CTotView drawing void CTotView::OnDraw(CDC* pDC) { CTotDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); //double rw=(double)CLW/BMW,rh=(double)CLH/BMH; int i,j; CClientDC dc(this); clearWnd; CDC*pMemDC=new CDC; pMemDC->CreateCompatibleDC(&dc); pMemDC->SelectObject(&jBitmap); for(i=0;i<CLW;i+=BMW) for(j=0;j<CLH;j+=BMH) dc.BitBlt(i,j,BMW,BMH,pMemDC,0,0,SRCCOPY); delete pMemDC; // TODO: add draw code for native data here } ///////////////////////////////////////////////////////////////////////////// // CTotView printing BOOL CTotView::OnPreparePrinting(CPrintInfo* pInfo) { // default preparation return DoPreparePrinting(pInfo); } void CTotView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add extra initialization before printing } void CTotView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/) { // TODO: add cleanup after printing } ///////////////////////////////////////////////////////////////////////////// // CTotView diagnostics #ifdef _DEBUG void CTotView::AssertValid() const { CView::AssertValid(); } void CTotView::Dump(CDumpContext& dc) const { CView::Dump(dc); } CTotDoc* CTotView::GetDocument() // non-debug version is inline { ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTotDoc))); return (CTotDoc*)m_pDocument; } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CTotView message handlers void CTotView::OnMenu1Data() {//extern BOOL m_bLogin; // TODO: Add your command handler code here CLogDialog ldlg; ldlg.DoModal(); UpdateData(true); if(ldlg.m_accout=="jw"&&ldlg.m_pass=="0903") m_Login = TRUE; else m_Login = FALSE; } void CTotView::OnMenu2Data() { // TODO: Add your command handler code here CAskstateDialog adlg; adlg.DoModal(); } void CTotView::OnUpdateMenu2Data(CCmdUI* pCmdUI) { // TODO: Add your command update UI handler code here pCmdUI->Enable(m_Login); } void CTotView::OnSize(UINT nType, int cx, int cy) { CView::OnSize(nType, cx, cy); // TODO: Add your message handler code here CWnd::GetClientRect(&rect); }